<?php
	require(dirname(__FILE__)."/config.php");
	CheckPurview('plus_机构管理');
	require_once(DEDEINC.'/typelink.class.php');
	if(empty($dopost))
	{
		$dopost = '';
	}
	
	$aid = ereg_replace('[^0-9]','',$aid);
	$ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL']) ? "project_main.php" : $_COOKIE['ENV_GOBACK_URL'];
	
	if($dopost=='delete')
	{
		$dsql->ExecuteNoneQuery("Delete From `#@__project` where aid='$aid' ");
		ShowMsg("成功删除机构人员！",$ENV_GOBACK_URL);
		exit();
	}
	else if($dopost=='saveedit')
	{
		$query = "Update `#@__project`
		set
		typeid='$typeid',
		orderid='$orderid',
		username='$username',
		pic='$pic',
		job='$job',
		mainjob='$mainjob',
		address='$address',
		linkus='$linkus'
		where aid='$aid'
		";
		$dsql->ExecuteNoneQuery($query);
		ShowMsg("成功更改机构人员！",$ENV_GOBACK_URL);
		exit();
	}
	
	$row = $dsql->GetOne("Select * From `#@__project` where aid='$aid'");
	$dsql->Execute('dd','SELECT * FROM `#@__projecttype` ORDER BY id DESC');
	$option = '';
	while($arr = $dsql->GetArray('dd'))
	{
		if ($arr['id'] == $row['typeid'])
		{
			$option .= "<option value='{$arr['id']}' selected='selected'>{$arr['typename']}</option>\n\r";
			} else {
			$option .= "<option value='{$arr['id']}'>{$arr['typename']}</option>\n\r";
		}
	}
	include DedeInclude('templets/project_edit.htm');
	
?>